#ifndef EXACTVALIDATOR_H
#define EXACTVALIDATOR_H

#include "stringvalidator.h"
#include "pretreatmenthandler.h"
#include "global.h"

class ExactValidator : public StringValidator
{
public:
    ExactValidator();
    ExactValidator(const QString& pattern, const QString& errorMsg = "Exact match failed")
        : m_pattern(pattern), m_errorMsg(errorMsg) {}

    ValidationResult validate(const QString& input,
                              const std::vector<ValidationOption>& options = {}) const override {
        QString processed = PretreatmentHandler::preprocess(input, options);
        QString pattern = m_pattern;

        if (PretreatmentHandler::shouldApplyOption(options, TrimWhitespace)) {
            pattern = pattern.trimmed();
        }

        if (PretreatmentHandler::compareStrings(processed, pattern, options)) {
            return ValidationResult(true);
        }
        return ValidationResult(false, m_errorMsg.arg(m_pattern));
    }

private:
    QString m_pattern;
    QString m_errorMsg;
};

#endif // EXACTVALIDATOR_H
